package enumdemo;

import jdk.incubator.vector.VectorOperators;

import java.util.Arrays;

public enum TestEnum {

    //枚举对象
    RED,BLACK,GREEN,WHITE;

    public static void main(String[] args) {
        TestEnum[] testEnums = TestEnum.values();
        for (int i = 0; i < testEnums.length; i++) {
            System.out.println(testEnums[i]);
        }
    }

    public static void main1(String[] args) {
        TestEnum testEnum = RED;
        switch (testEnum){
            case RED :
                System.out.println("RED");
                break;
            case BLACK :
                System.out.println("BLACK");
                break;
            case GREEN :
                System.out.println("GREEN");
                break;
            case WHITE :
                System.out.println("WHITE");
                break;
            default:
                System.out.println("颜色错误");
                break;
        }
    }

}
